#ifndef MKDELEGATES_H
#define MKDELEGATES_H

#include <QItemDelegate>
#include <QVariant>

class MKFactoryDelegate : public QObject
{
public:
	MKFactoryDelegate(QObject *parent = 0);

	static QItemDelegate *delegateFromType(quint8 typeId);
};

//---------------------------------------------------------------------------------------------------------------------

class MKTypeDelegate : public QItemDelegate
{
	Q_OBJECT

public:
	MKTypeDelegate(QObject *parent = 0);

	QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &index) const;
	void setEditorData(QWidget *editor, const QModelIndex &index) const;
	void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
	void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &) const;
};

//---------------------------------------------------------------------------------------------------------------------

class MKCategoryDelegate : public QItemDelegate
{
	Q_OBJECT

public:
	MKCategoryDelegate(QObject *parent = 0);

	QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &) const;
	void setEditorData(QWidget *editor, const QModelIndex &index) const;
	void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
	void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &) const;
};

//---------------------------------------------------------------------------------------------------------------------

class MKDateDelegate : public QItemDelegate
{
	Q_OBJECT

public:
	MKDateDelegate(QObject *parent = 0);

	QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &) const;
	void setEditorData(QWidget *editor, const QModelIndex &index) const;
	void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
	void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &) const;
};

#endif // MKDELEGATES_H
